/*
 * OPIAM Suite
 *
 * Distributable under LGPL license.
 * See terms of license at gnu.org.
 */

package opiam.admin.faare.service.services.triggers;

import opiam.admin.faare.config.javabeans.JBTrigger;
import opiam.admin.faare.exception.ServiceException;
import opiam.admin.faare.persistence.javabeans.JBTop;
import opiam.admin.faare.service.UserContext;

import java.util.Properties;


/**
 * Actions to be called bu the trigger service must implement this interface.
 *
 */
public interface TriggerInterface
{
    /**
     * Method called at application initialization.<br>
     *
     * @param props parameters of the trigger, set in triggers_conf.xml
     * @param directory Configuration directory if any.
     *
     */
    void initialize(Properties props, String directory);

    /**
     * Method called to perform the trigger action.
     *
     * @param triggerDesc Trigger descriptor.
     * @param entry Entry which is subject of the operation launching the trigger.
     * @param userContext Connected user context.
     *
     * @throws ServiceException in case of error.
     */
    void execute(JBTrigger triggerDesc, JBTop entry, UserContext userContext)
        throws ServiceException;
}
